package cn.wen233.orderconsumer.api;

import cn.wen233.common.api.R;
import cn.wen233.orderconsumer.infrustructure.feign.OrderFeign;
import com.netflix.ribbon.proxy.annotation.Hystrix;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Primary;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 使用Feign进行服务间的调用
 *
 * @author wenei
 * @date 2021-06-05 15:32
 */
@RestController
@RequestMapping("/orders")
public class OrderFeignApi {

    private final OrderFeign orderFeign;

    public OrderFeignApi(@Qualifier("IOrderFeign") OrderFeign orderFeign) {
        this.orderFeign = orderFeign;
    }

    @GetMapping("/2")
    public R<?> getOrder() {
        return R.success(orderFeign.getOrder("2"));
    }
}
